package com.lwq.seata.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lwq.seata.entity.TAmount;
import com.lwq.seata.mapper.TAmountMapper;
import com.lwq.seata.service.ITAmountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 刘文强
 * @since 2021-09-15
 */
@Service
public class TAmountServiceImpl extends ServiceImpl<TAmountMapper, TAmount> implements ITAmountService {


    @Autowired
    private TAmountMapper amountMapper;
    /**
     * 减金额
     *
     * @param userId
     * @param amount
     * @return
     */
    @Override
    @Transactional
    public boolean decrementAmount(Long userId, Long amount) {
        amountMapper.decrementAmount(userId, amount);
        return true;
    }
}
